<?php
/**
 * Here the framework internal error handler is defined.
 *
 * @author   Kado <ulfikado@gmail.com>
 * @category Beluga PHP5.3+ Framework
 * @package  BF\Core
 * @since    2015-01-17 14:29
 * @version  0.1
 */

namespace BF
{

   /**
    * Never use this function inside you're code!
    *
    * @internal
    * @ignore
    */
   function errorHandler( $errno, $errstr, $errfile, $errline )
   {

      switch ( $errno )
      {
         case \E_DEPRECATED:
         case \E_NOTICE:
         case \E_STRICT:
         case \E_USER_DEPRECATED:
         case \E_USER_NOTICE:

            if ( \BF\FrameworkConfig::GetInstance()->TriggerNotices )
            {
               throw new \BF\PhpException( $errstr, $errno, $errline, $errfile );
            }

            break;

         default:

            throw new \BF\PhpException( $errstr, $errno, $errline, $errfile );

      }

   }

   // Register the framework error handler.
   \set_error_handler( '\\BF\\errorHandler' );

}

